<template>
  <div>
    <el-row :gutter="20">
      <el-col :span="6">
        <div class="item"></div>
      </el-col>
      <el-col :span="6">
        <div class="item"></div>
      </el-col>
      <el-col :span="6">
        <div class="item"></div>
      </el-col>
      <el-col :span="6">
        <div class="item"></div>
      </el-col>
    </el-row>

    <el-row :gutter="20">
      <el-col :span="12">
        <div class="item"></div>
      </el-col>
      <el-col :span="12">
        <div class="item" id="echarts"></div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  // 组件名称
  name: "",
  props: [],
  data() {
    return {};
  },
  mounted(){
    this.initEcharts();
  },
  methods: {
       //初始化echarts
   initEcharts(){
     var myChart = this.$echarts.init(document.getElementById("echarts"));
    // 指定图表的配置项和数据
    var option = {
      title: {
        text: "ECharts 入门示例"
      },
      tooltip: {},
      legend: {
        data: ["销量"]
      },
      xAxis: {
        data: ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"]
      },
      yAxis: {},
      series: [
        {
          name: "销量",
          type: "bar",
          data: [5, 20, 36, 10, 10, 20]
        }
      ]
    };
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
    this.$axios.post("/admin/login",{username:"admin",password:"admin"}).then(res=>{
      console.log(res)
    }).catch(error=>{
      console.log(error.response.data);
    })
   }
  },

};
</script>

<style  lang="scss" scoped>
.el-row {
  margin-bottom: 20px;
  .item {
    background: #f8f8f8;
    border: 1px solid #dddddd;
    border-radius: 5px;
    padding: 15px;
    box-sizing: border-box;
    #echarts {
      width: 100%;
    }
  }
}
</style>
